<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head>
    <meta charset="UTF-8">
    <title>分页模板</title>
</head>
<body>
    <div th:fragment="page">
        <span>
            <input shiro:hasPermissions="[*:list,*:add]" class="main_con_btn main_con_btn_pri" type="button" value="批量删除" onclick="batchRemove()" />
            <input shiro:hasPermissions="[stu:list,charge:list]"
                   th:if="${#strings.contains(#request.getRequestURI(),'stu') || #strings.contains(#request.getRequestURI(),'charge')}"
               class="main_con_btn main_con_btn_suc" type="button" value="导出信息" onclick="exportInfo()" />
            <input shiro:hasPermissions="[menu:list,role:list]"
                   th:if="${#strings.contains(#request.getRequestURI(),'role') || #strings.contains(#request.getRequestURI(),'menu')}"
               class="main_con_btn main_con_btn_add" type="button" value="添加信息" onclick="addInfo()" />
            <input shiro:hasPermission="user:list" th:if="*{#strings.equals(param.flag,'1')}"
               class="main_con_btn main_con_btn_info" type="button" value="批量恢复" onclick="batchRecover()" />
        </span>
        <ul class="con_nubmer_span fr">
            <li class="main_page_info fl">
                总共[[${page.total}]]条记录&nbsp;&nbsp;每页显示
                <select style="height: 25px;" id="pageSize" onchange="pageSizeChange()">
                    <option value="5" th:selected="*{#strings.equals(param.pSize,'5')}">5</option>
                    <option value="10" th:selected="*{#strings.equals(param.pSize,'10')}">10</option>
                    <option value="15" th:selected="*{#strings.equals(param.pSize,'15')}">15</option>
                    <option value="25" th:selected="*{#strings.equals(param.pSize,'25')}">25</option>
                    <option value="50" th:selected="*{#strings.equals(param.pSize,'50')}">50</option>
                    <option value="100" th:selected="*{#strings.equals(param.pSize,'100')}">100</option>
                </select>
                条记录&nbsp;&nbsp;当前第[[${page.pageNum}]]页
            </li>
            <!-- 上一页 -->
            <li class="fl">
            <a href="javascript:void(0);" th:onclick="'javascript:goPage('+${page.pageNum>1?page.pageNum-1:1}+')'">&laquo;</a>
            </li>

            <!-- 页数 -->
            <li th:if="${page.pageNum <= 4}" th:each="num : ${#numbers.sequence(1, page.pages-1>=4?4 : page.pages)}" class="fl">
                <a href="javascript:void(0);"  th:class="${page.pageNum==num?' active':''}" th:onclick="'javascript:goPage('+${num}+')'">[[${num}]]</a>
                <a href="javascript:void(0)" th:if="${page.pages-1>4 && num == 4}">.&nbsp;.&nbsp;.</a>
            </li>

            <li th:if="${page.pageNum > 4}" class="fl">
                <a href="javascript:void(0);" onclick="javascript:goPage(1)">1</a>
                <a href="javascript:void(0);" onclick="javascript:goPage(2)">2</a>
                <a href="javascript:void(0)" th:if="${page.pages-1>4 }">.&nbsp;.&nbsp;.</a>
            </li>

            <li th:if="${page.pageNum > 4 && page.pageNum <= page.pages}"
                th:each="num : ${#numbers.sequence((page.pageNum >= page.pages-2)?((page.pages-2>4)?page.pages-4:page.pages-2):page.pageNum-1,(page.pageNum >= page.pages-2)?((page.pages-2>4)?page.pages-3:page.pages-1):page.pageNum+1)}"
                class="fl">
                <a href="javascript:void(0);"  th:class="${page.pageNum==num?' active':''}" th:onclick="'javascript:goPage('+${num}+')'">[[${num}]]</a>
                <a href="javascript:void(0)" th:if="${num == page.pageNum+1}">.&nbsp;.&nbsp;.</a>
            </li>

            <li th:if="${page.pages > 4 && page.pageNum <= page.pages}" th:each="num : ${#numbers.sequence((page.pages-2>4)?((page.pageNum >= page.pages-2)?page.pages-2:page.pages-1):page.pages,page.pages)}" class="fl">
                <a href="javascript:void(0);"  th:class="${page.pageNum==num?' active':''}" th:onclick="'javascript:goPage('+${num}+')'">[[${num}]]</a>
            </li>

            <!-- 下一页 -->
            <li class="fl">
                <a href="javascript:void(0);" th:onclick="'javascript:goPage('+${page.pageNum<page.pages?page.pageNum+1:page.pages}+')'">&raquo;</a>
            </li>
            <li th:orthe></li>
        </ul>
        <div class="clear"></div>
    </div>
</body>
</html>